package com.ynr.common.controller;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ynr.common.utils.CodeInfoEnum;
import com.ynr.common.utils.CommonResult;
import com.ynr.common.utils.ResultUtil;

@ControllerAdvice
public class AdviceController {

	private static final Logger logger = LoggerFactory
			.getLogger(AdviceController.class);
	
	/*@ExceptionHandler(value={UnauthorizedException.class, AuthenticationException.class})
	@ResponseBody
    public CommonResult unauthorizedExceptionHandler(Exception e) {
        logger.debug("unauthorizedExceptionHandler-exception:{}", e.toString());
        return ResultUtil.returnError(CodeInfoEnum.GLOBAL_UNAUTHORIZED_EXCEPTION, e.toString());
    }*/ 
	
	/*@ExceptionHandler(value=Exception.class)
	@ResponseBody
    public CommonResult exceptionHandler(Exception e) {
        logger.debug("exceptionHandler-exception:{}", e.toString());
        return ResultUtil.returnError(CodeInfoEnum.GLOBAL_EXCEPTION, e.toString());
    }*/ 
}